var addPerson;
var addItem;
var xmlhttp = new getXMLObject();

function openPersonForm()
{
	addPerson = window.open("new_person_form.html", "addPerson", "status=no, menubar=no, resizable=no, height=200, width=400");
}

function openItemForm()
{
	addItem = window.open("new_item_form.html", "addItem", "status=no, menubar=no, resizable=no, height=150, width=400");
}

function getXMLObject()  //XML OBJECT
{
   var xmlHttp = false;
   try 
   {
     xmlHttp = new ActiveXObject("Msxml2.XMLHTTP")  // For Old Microsoft Browsers
   }
   catch (e) 
   {
     try 
	 {
       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP")  // For Microsoft IE 6.0+
     }
     catch (e2) 
	 {
       xmlHttp = false   // No Browser accepts the XMLHTTP Object then false
     }
   }
   if (!xmlHttp && typeof XMLHttpRequest != 'undefined') 
   {
     xmlHttp = new XMLHttpRequest();        //For Mozilla, Opera Browsers
   }
   return xmlHttp;  // Mandatory Statement returning the ajax object created
}
 
function ajaxFunction(url) //url passed from html page including parameters
{
  if(xmlhttp) 
  {
    xmlhttp.open("GET", url, true);
    xmlhttp.onreadystatechange = handleServerResponse;
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.send();
	
  }
}
 
function handleServerResponse() 
{
   if (xmlhttp.readyState == 4) 
   {
     if(xmlhttp.status == 200) 
	 {
       document.getElementById("records_container").innerHTML=xmlhttp.responseText;
     }
     else 
	 {
        alert("Error during AJAX call. Please try again");
     }
   }
}